home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / src / demos / GL / libdemo / ui.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-08-02  |  2.8 KB  |  75 lines

  1. /*
  2.  * Copyright 1991, 1992, 1993, 1994, Silicon Graphics, Inc.
  3.  * All Rights Reserved.
  4.  *
  5.  * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
  6.  * the contents of this file may not be disclosed to third parties, copied or
  7.  * duplicated in any form, in whole or in part, without the prior written
  8.  * permission of Silicon Graphics, Inc.
  9.  *
  10.  * RESTRICTED RIGHTS LEGEND:
  11.  * Use, duplication or disclosure by the Government is subject to restrictions
  12.  * as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
  13.  * and Computer Software clause at DFARS 252.227-7013, and/or in similar or
  14.  * successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
  15.  * rights reserved under the Copyright Laws of the United States.
  16.  */
  17. /*
  18.  *    ui.h
  19.  *  Written by Gavin Bell for Silicon Graphics, November 1988.
  20.  *
  21.  * This interface uses the LEFTMOUSE and MIDDLEMOUSE buttons to
  22.  * implement 3D rotations and translations.  X-Y translation (pan) is
  23.  * done using the left mousebutton.  Z translation (zoom) is done
  24.  * using the left AND middle mouse buttons, held down together.  XYZ
  25.  * rotations are done using the middle mouse button; the center of the
  26.  * window becomes the center of a virtual trackball.
  27.  *
  28.  * The interface will automatically use the Spatial Systems Spaceball
  29.  * 3D input device, if it is available.
  30.  *
  31.  * The interface uses the input-queue event handler program; see
  32.  * 'event.h' for a description of those routines.  Also see
  33.  * 'example.c' for a complete but simple example of how to use all of
  34.  * these routines.
  35.  */
  36.  
  37. #include "event.h"
  38. #include "trackball.h"
  39. #include "vect.h"
  40.  
  41. /*
  42.  * The main routine takes one argument; the function to be called when
  43.  * the user interacts with the interface.  This function will be
  44.  * passed two arguments; a rotation quaternion, and a translation
  45.  * vector.  See 'example.c' for an example application using this
  46.  * interface.
  47.  *
  48.  * Since the user interface does several gl calls, a window must be
  49.  * open and active when ui() is first called (this user interface will
  50.  * respond only to events which happen in the window that is active
  51.  * when ui() is first called).
  52.  *
  53.  * Note that this function does not terminate until ui_exit is called.
  54.  */
  55. void ui(void (*fn)(float *, float *));
  56.  
  57. /*
  58.  *    Call ui_active(FALSE) to make the user interface become inactive.
  59.  * Calling ui_active(TRUE) will make it active again.  This allows the
  60.  * program to free-up the left and middle buttons for other tasks.
  61.  */
  62. void ui_active(int);
  63.  
  64. /*
  65.  *    Call ui_exit when it is time for the interface to go away permanently.
  66.  */
  67. void ui_exit(void);
  68.  
  69. /*
  70.  *    These two flags are always opposites, and keep track of if the
  71.  * interface is being used or not (if the mouse buttons are being held
  72.  * down and the object being dragged).
  73.  */
  74. extern int ui_noisy, ui_quiet;
  75.